-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide ExitStatusError #82973
Provide ExitStatusError #82973
Conversation
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #82982) made this pull request unmergeable. Please resolve the merge conflicts. |
22c4028
to
d2ac93c
Compare
cc @yaahc for review regarding the handling of exit statuses as errors, and potential interaction with Termination and other error-handling proposals. |
I considered the potential interactions with several areas of process exit status handling. A review is a good idea, but it might be helpful to set out my thoughs:
There is also To discuss this clearly means dealing with a terminological problem. On Unix there is a "wait status" (as you get from Rust stdlib uses the term "exit code" (or just I am going to use the term "exit value integer" for the value passed to One problem is that Rust stdlib thinks an exit value integer is For example, on Fuchsia (AFAICT) the actual exit value integer is a Another example: on Unix you can pass a value
My present MR does not attempt to drain this swamp. I think it could only be drained by replacing many of the affected methods in I think that my addition of |
I'm not suggesting this PR needs to solve this problem. Rather, there are specific proposals in development to allow attaching information to errors, such as the numeric value to exit the process with, or am HTTP response code. I'm asking for @yaahc's review to see if this potentially interacts with any of those proposals. |
reviewing, also cc @JDuchniewicz who is currently leading the effort on stabilizing edit: still reviewing, but this seems for the most part separate from |
Hi. I think all the comments so far have been addressed. I would like to get this merged because it's blocking fixing almost all the examples for @yaahc I think you are happy that this doesn't cause trouble for the stabilisation of If that review is positive, I'll open a tracking issue, update the MR (and probably rebase...), etc. Thanks. |
I'm quite confident there won't be any issues here with respect to the
I've gone ahead and done another review pass with a few more comments. Once those get resolved I think we can either go ahead and merge this, or, if there are still changes to the stable API of |
Read through the PR and it looks good to me. As @yaahc mentioned, it will allow us for more options for reporting the error/exit status inside the |
This comment has been minimized.
This comment has been minimized.
@yaahc Thanks for the review. I think I have addressed your comments. I also opened a tracking issue and updated the For now I haven't squashed this down to assist re-review. Let me know when I should do that (and rebase onto current trunk). |
☔ The latest upstream changes (presumably #84200) made this pull request unmergeable. Please resolve the merge conflicts. |
Signed-off-by: Ian Jackson <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not catching this earlier but there is one last change we need to make to the documentation on ExitStatusExt before this can merge, but I think it's good to go once this is resolved.
It is unergnomic to have to say things like bad.into_status().signal() Implementing `ExitStatusExt` for `ExitStatusError` fixes this. Unfortunately it does mean making a previously-infallible method capable of panicing, although of course the existing impl remains infallible. The alternative would be a whole new `ExitStatusErrorExt` trait. `<ExitStatus as ExitStatusExt>::into_raw()` is not particularly ergonomic to call because of the often-required type annotation. See for example the code in the test case in library/std/src/sys/unix/process/process_unix/tests.rs Perhaps we should provide equivalent free functions for `ExitStatus` and `ExitStatusExt` in std::os::unix::process and maybe deprecate this trait method. But I think that is for the future. Signed-off-by: Ian Jackson <[email protected]>
Co-authored-by: Josh Triplett <[email protected]>
Co-authored-by: Jane Lusby <[email protected]>
Signed-off-by: Ian Jackson <[email protected]>
We should revert this commit when this is stabilised. Signed-off-by: Ian Jackson <[email protected]>
@yaahc Thanks for the review. I have fixed the WASM build, I think - it compiles locally, anyway. I also checked the entries in I also took the opportunity to autosquash the fixmes into the underlying commits. I didn't rebase, so the "force pushed" message from github (or plain |
@yaahc Would you mind giving this your (re)review and approval? |
@bors r+ |
📌 Commit 26c782b has been approved by |
☀️ Test successful - checks-actions |
Performance triage indicates that this PR introduced a 1.7% regression when fully compiling I don't think any performance hit was expected. However, it also seems like this may be just noise. |
How strange. Can you perhaps give me a reference to what "coercions-debug" is? I searched rust-lang/rust for it, and asked a general search engine, and I looked for links in the perf report you linked to, but none of those approaches was fruitful.
Definitely, a performance hit was not expected. I see the result is annotated with a single |
@ijackson yeah we are actually discussing the noise associated with this specific benchmark in Zulip now (zulip archive, zulip live) The source code to coercions is here: https://github.com/rust-lang/rustc-perf/blob/master/collector/benchmarks/coercions/src/main.rs It is definitely a micro-benchmark that is not representative of real code. (And, again, to be clear, We think we are just seeing noise here. Not something actually problematic in your PR.) |
Thanks for the link. So I see!
Right, OK, thanks. Happy hunting. (I have bookmarked that paper by Kalibera & Jones since it piqued my curiosity) |
Fix `vxworks` Some PRs made the `vxworks` target not build anymore. This PR fixes that: - rust-lang#82973: copy `ExitStatusError` implementation from `unix`. - rust-lang#84716: no `libc::chroot` available on `vxworks`, so for now don't implement `os::unix::fs::chroot`.
Tracking Issue: #84908
Closes #73125
In MR #81452 "Add #[must_use] to [...] process::ExitStatus" we concluded that the existing arrangements in are too awkward so adding that
#[must_use]
is blocked on improving the ergonomics.I wrote a mini-RFC-style discusion of the approach in #73125 (comment)